package Array;/*
 *
 * @author 陈粒
 * @version 创建时间：2021/7/1 15:44
 */
/**
 * 随机生成数可能会出现重复数
 */

import java.util.*;

public class Random_Number {
    public static void main(String[] args) {
        int[] a = new int[10];
        int[] b = new int[10];
        int[] c = new int[10];
        int[] d = new int[10];
        for (int i = 0; i < a.length; i++) {
            a[i] = new Random().nextInt(100);//[0,100)或[0, 99]
        }
        for (int i = 0; i < b.length; i++) {
            b[i] = new Random().nextInt(100) + 1;//[1,101)或[1,100]
        }
        for (int i = 0; i < c.length; i++) {
            c[i] = new Random().nextInt(90);//[0,90)或[0,89]
        }
        for (int i = 0; i < d.length; i++) {
            d[i] = new Random().nextInt(90) + 10;//[10,100)或[10,99]
        }
        System.out.println("0到99的10个随机数为：");
        Arrays.sort(a);
        System.out.println(Arrays.toString(a));
        System.out.println("1到100的10个随机数为：");
        Arrays.sort(b);
        System.out.println(Arrays.toString(b));
        System.out.println("0到89的10个随机数为：");
        Arrays.sort(c);
        System.out.println(Arrays.toString(c));
        System.out.println("10到99的10个随机数为：");
        Arrays.sort(d);
        System.out.println(Arrays.toString(d));
    }
}